#pragma once
#include "imtPublic.h"

#define imdGetWindow(windwoManager, WindowType, windowName) \
	(CEGUI::WindowType*)windwoManager->getWindow(windowName);\

#define imdSetupGuiEventHandler(WindowType, windowName, strEvent, Class, handler) \
{\
	CEGUI::WindowManager* windwoManager = CEGUI::WindowManager::getSingletonPtr(); \
    CEGUI::WindowType* win = (CEGUI::WindowType*)windwoManager->getWindow(windowName);\
	if (win) \
	{ \
		win->subscribeEvent(strEvent, CEGUI::Event::Subscriber(&Class::handler, this)); \
	} \
}\

#define imdCheckEventSource(e, windowName) \
	((static_cast<const CEGUI::WindowEventArgs&>(e).window) && \
	 (static_cast<const CEGUI::WindowEventArgs&>(e).window)->getName() == windowName) \

#define imdGetEventSource(e, WindowType) \
	(static_cast<CEGUI::WindowType*>(static_cast<const CEGUI::WindowEventArgs&>(e).window))